home *** CD-ROM | disk | FTP | other *** search
- ; ABOUT THIS FILE
- ; ---------------
- ;
- ; Null lines and lines starting with a semi-colon are ignored.
- ;
- ; NOTE: A POM file may contain up to 500 lines of specifications. Comment
- ; lines do not count.
- ;
- ;
- ; PARSE-O-MATIC COMMAND LINE
- ; --------------------------
- ;
- ; POM pom-file input-file output-file
- ;
- ;
- ; COMMAND WORDS
- ; -------------
- ;
- ; MINLEN number
- ; Specifies the minimum length a line must be to be considered for parsing.
- ; (Note that null lines are always ignored)
- ;
- ; IGNORE value1 value2
- ; When value1 contains value2, the line is ignored and all further processing
- ; on the line stops. The usual format of this command is something like:
- ; IGNORE $FLINE[3 9] "Date"
- ; This would skip any input line that contains the word "Date" between
- ; columns 3 and 9 ($FLINE references the line just read).
- ;
- ; IF value1 value2 var1 value3 [value4]
- ; If value1 matches value2, var1 is set to value3. Otherwise, it is
- ; set to value4. If value4 is missing, nothing is done (i.e. var1
- ; is not changed).
- ;
- ; OUT[END] value1 value2 |output-picture
- ; This is two command words: OUT and OUTEND. OUT writes to the output
- ; file without an end-of-line. OUTEND writes an end-of-line to the file.
- ; When value1 matches value2, a line is output to the output file,
- ; according to the output picture. Within the output picture, all
- ; text is taken literally (i.e. " is taken to mean literally that --
- ; a quotation mark character). The only exception to this is that
- ; variable names are identified by the { and } characters. For
- ; example, the line: OUTEND "X" "X" |{$FLUPC} would simply
- ; output (in uppercase) every non-IGNOREd line in the input file.
- ; NOTE: OUT does not actually write to the output file; it accumulates the
- ; output. You must do an OUTEND to actually write the data. The maximum
- ; line length allowed is 255 characters.
- ;
- ; TRIM var1 spec1 character
- ; Removes characters from var1. This is usually used to remove blanks.
- ; spec1 can be: A=All B=Both ends L=Left side only R = Right side only
- ;
- ; CHANGE var1 value1 value2
- ; Replaces ALL occurances of value1 with value2
- ;
- ; TRACE var1
- ; Reports the value of var1 in the trace file (POM.TRC) if tracing has been
- ; enabled (with the DOS command SET POM=T).
- ;
- ;
- ; VALUES
- ; ------
- ;
- ; A value can be specified in the following ways:
- ; "text" A literal text string
- ; VARNAME The name of a variable
- ; VARNAME[start end] A substring of a variable
- ; VARNAME[start] A single character
- ; VARNAME+ Increments variable (see explanation below)
- ;
- ; Variable names can be up to 8 characters long. You can create up to 100
- ; variables and literals (this number includes the predefined variables).
- ;
- ; Parse-O-Matic defines several predefined variables. They are:
- ; $FLINE = The line just read from the file
- ; $FLUPC = The line just read from the file, in uppercase
- ; $BRL = The { character (used in OUT)
- ; $BRR = The } character (used in OUT)
- ;
- ;
- ; NOTE ABOUT DELIMITERS
- ; ---------------------
- ;
- ; If you have to specify a quotation mark, use "". For example:
- ; IGNORE "He said ""Hello"" to me."
- ; This would ignore lines containing: He said "Hello" to me.
- ;
- ;
- ; ILLEGAL CHARACTERS
- ; ------------------
- ;
- ; No command can contain the following ASCII characters:
- ; $00 (Null) $0A (LF) $0D (CR)
- ; Of course, LF and CR do appear at the very end of each line.
- ;
- ;
- ; INCREMENTING
- ; ------------
- ;
- ; Only numeric incrementing is supported at this time. Attempting to
- ; increment another type of variable will result in an error.
- ;
- ; Incrementing "1" gives you "2"
- ; Incrementing "9" gives you "10"
- ;
- ;
- MINLEN "85"
- ;
- IGNORE $FLINE[ 01 08] "Date: "
- IGNORE $FLINE[ 49 67] "Order Expected"
- IGNORE $FLINE[ 49 68] "Date Ship Date"
- IGNORE $FLINE[ 10 32] "Item number/Description"
- ;
- ; Tidy up file line
- ;
- CHANGE $FLINE """" "'"
- ;
- ; Determine where we are
- ;
- IF $FLINE[8] " " ITEMCNTR ITEMCNTR+ "0"
- ;
- ; Set variables
- ;
- IF ITEMCNTR "0" REFNUM $FLINE[ 1 8]
- IF ITEMCNTR "0" CUSTCODE $FLINE[ 10 15]
- IF ITEMCNTR "0" CUSTDESC $FLINE[ 17 47]
- IF ITEMCNTR "0" ORDRDATE $FLINE[ 49 57]
- IF ITEMCNTR "0" MSTRCVDT $FLINE[ 60 68]
- IF ITEMCNTR "1" PRICE $FLINE[105 114]
- IF ITEMCNTR "1" QTY $FLINE[ 76 86]
- IF ITEMCNTR "1" PARTNUM $FLINE[ 10 32]
- IF ITEMCNTR "2" DESCRIP $FLINE[ 10 43]
- ;
- ; Tidy up variables
- ;
- TRIM REFNUM "B" " "
- TRIM CUSTCODE "B" " "
- TRIM CUSTDESC "B" " "
- TRIM ORDRDATE "B" " "
- TRIM MSTRCVDT "B" " "
- TRIM PRICE "B" " "
- TRIM PRICE "A" ","
- TRIM QTY "B" " "
- TRIM PARTNUM "B" " "
- TRIM DESCRIP "B" " "
- IF PRICE "" PRICE "0.00"
- IF QTY "" QTY "0"
- ;
- ; Output
- ;
- OUT ITEMCNTR "2" |"{REFNUM}","{CUSTCODE}","{CUSTDESC}","{ORDRDATE}",
- OUT ITEMCNTR "2" |"{MSTRCVDT}",{PRICE},{QTY},"{PARTNUM}",
- OUTEND ITEMCNTR "2" |"{DESCRIP}"
- ;
- ; Reset item counter
- ;
- IF ITEMCNTR "2" ITEMCNTR "0"
-